<?php

/**
 * sfGuardUser form.
 *
 * @package    form
 * @subpackage sf_guard_user
 * @version    SVN: $Id: sfGuardUserForm.class.php 13001 2008-11-14 10:45:32Z noel $
 */
class AdvForm extends BasesfGuardUserForm
{
  protected
    $pkName = null;

  public function configure()
  {
    parent::configure();
   
    

    unset(
      $this['last_login'],
      $this['created_at'],
      $this['salt'],
      $this['algorithm'],   
      $this['algorithm'],   
      $this['is_active'],
      $this['is_super_admin'],
      $this['sf_guard_user_group_list'],
      $this['sf_guard_user_permission_list']
    );
    
     $lang = array('ru','en');
    
     $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      
      	
     ));
     
                        //$this->widgetSchema['gender'] =  new sfWidgetFormInputHidden(array(),array('value'=>'w'));

		 	$this->widgetSchema['is_online'] =  new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['width_photo'] =  new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['width_video'] =  new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['is_new'] =  new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['country'] = new sfWidgetFormSelect(array('choices' =>sfContext::getInstance()->getUser()->getSearchCountry()));

		 	$this->widgetSchema['language'] = new sfWidgetFormI18nSelectLanguage(array('culture' => sfContext::getInstance()->getUser()->getCulture(),'languages'=>$lang));

		 	$this->widgetSchema['have_child'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['have_child_partner'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['gender'] = new sfWidgetFormChoice(array('choices' => array('m'=>__('Man'), 'w'=>__('Woman'))));

		 	$this->widgetSchema['eye_color'] = new sfWidgetFormChoice(array('choices' => myTools::getEyeColor()));

		 	$this->widgetSchema['hair_lenght'] = new sfWidgetFormChoice(array('choices' => myTools::getHairleng()));

		 	$this->widgetSchema['hair_color'] = new sfWidgetFormChoice(array('choices' => myTools::getHairColor()));

		 	$this->widgetSchema['hair_type'] = new sfWidgetFormChoice(array('choices' => myTools::getHairtype()));

		 	$this->widgetSchema['education'] = new sfWidgetFormChoice(array('choices' => myTools::getEducation()));

		 	$this->widgetSchema['religion'] = new sfWidgetFormChoice(array('choices' => myTools::getReligion()));

		 	$this->widgetSchema['is_marital'] = new sfWidgetFormChoice(array('choices' => myTools::getIsmarital()));
			 

		 
                         $this->widgetSchema['age_from'] =  new sfWidgetFormChoice(array('choices' => myTools::getAge()));
                         $this->widgetSchema['age_to'] =  new sfWidgetFormChoice(array('choices' => myTools::getAge()));

                         $this->widgetSchema['height_from'] = new sfWidgetFormChoice(array('choices' => myTools::getRost()));
                         $this->widgetSchema['height_to'] = new sfWidgetFormChoice(array('choices' => myTools::getRost()));


                         $this->widgetSchema['ves_from'] = new sfWidgetFormChoice(array('choices' => myTools::getVes()));
                         $this->widgetSchema['ves_to'] = new sfWidgetFormChoice(array('choices' => myTools::getVes()));

		 	
     
	     $this->widgetSchema->setLabels(
    array(
      'username'  => __('Логин'),
      'nickname'    => __('Ник'),
      'avatar'   => __('Аватар'),  
      'icq' => __('Номер ICQ'),
      'skype' => __('Номер skype'),
      'email'     => __('E-mail'),
      'password'  => __('Пароль'),
      'country' => __('Страна'),
      'gender' => __('Пол'),
      'birthday' => __('Дата рождения'),
      'password2' => __('Повтор пароля')
    )
    ); 
	    
	    
	     $this->validatorSchema->setOption('allow_extra_fields', true);
	     $this->widgetSchema->setNameFormat('%s');
	     if(sfConfig::get('app_form_pf_i18n')==true)
	     {
		 $this->embedI18n(array('en', 'ru'));
	     }
     
	     
       if(sfConfig::get('app_form_transform_adv_search')=='true')
     {
		$formatter = new csWidgetFormSchemaFormatterJQTransform($this->widgetSchema);
	    $this->widgetSchema->addFormFormatter('cs-formatter', $formatter);
	    $this->widgetSchema->setFormFormatterName('cs-formatter'); 
     }   
     
  }
}
